package com.bestow.lease.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bestow.common.annotation.Log;
import com.bestow.common.core.controller.BaseController;
import com.bestow.common.core.domain.AjaxResult;
import com.bestow.common.enums.BusinessType;
import com.bestow.lease.domain.PrjBasicRiskHd;
import com.bestow.lease.service.IPrjBasicRiskHdService;
import com.bestow.common.utils.poi.ExcelUtil;
import com.bestow.common.core.page.TableDataInfo;

/**
 * 放款前提页签显示标识Controller
 * 
 * @author liliu
 * @date 2022-12-07
 */
@RestController
@RequestMapping("/lease/basicRiskHd")
public class PrjBasicRiskHdController extends BaseController
{
    @Autowired
    private IPrjBasicRiskHdService prjBasicRiskHdService;

    /**
     * 查询放款前提页签显示标识列表
     */
    @PreAuthorize("@ss.hasPermi('lease:basicRiskHd:list')")
    @GetMapping("/list")
    public TableDataInfo list(PrjBasicRiskHd prjBasicRiskHd)
    {
        startPage();
        List<PrjBasicRiskHd> list = prjBasicRiskHdService.selectPrjBasicRiskHdList(prjBasicRiskHd);
        return getDataTable(list);
    }

    /**
     * 导出放款前提页签显示标识列表
     */
    @PreAuthorize("@ss.hasPermi('lease:basicRiskHd:export')")
    @Log(title = "放款前提页签显示标识", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PrjBasicRiskHd prjBasicRiskHd)
    {
        List<PrjBasicRiskHd> list = prjBasicRiskHdService.selectPrjBasicRiskHdList(prjBasicRiskHd);
        ExcelUtil<PrjBasicRiskHd> util = new ExcelUtil<PrjBasicRiskHd>(PrjBasicRiskHd.class);
        util.exportExcel(response, list, "放款前提页签显示标识数据");
    }

    /**
     * 获取放款前提页签显示标识详细信息
     */
    @PreAuthorize("@ss.hasPermi('lease:basicRiskHd:query')")
    @GetMapping(value = "/{basicRiskHdId}")
    public AjaxResult getInfo(@PathVariable("basicRiskHdId") Long basicRiskHdId)
    {
        return AjaxResult.success(prjBasicRiskHdService.selectPrjBasicRiskHdByBasicRiskHdId(basicRiskHdId));
    }

    /**
     * 新增放款前提页签显示标识
     */
    @PreAuthorize("@ss.hasPermi('lease:basicRiskHd:add')")
    @Log(title = "放款前提页签显示标识", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PrjBasicRiskHd prjBasicRiskHd)
    {
        return toAjax(prjBasicRiskHdService.insertPrjBasicRiskHd(prjBasicRiskHd));
    }

    /**
     * 修改放款前提页签显示标识
     */
    @PreAuthorize("@ss.hasPermi('lease:basicRiskHd:edit')")
    @Log(title = "放款前提页签显示标识", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PrjBasicRiskHd prjBasicRiskHd)
    {
        return toAjax(prjBasicRiskHdService.updatePrjBasicRiskHd(prjBasicRiskHd));
    }

    /**
     * 删除放款前提页签显示标识
     */
    @PreAuthorize("@ss.hasPermi('lease:basicRiskHd:remove')")
    @Log(title = "放款前提页签显示标识", businessType = BusinessType.DELETE)
	@DeleteMapping("/{basicRiskHdIds}")
    public AjaxResult remove(@PathVariable Long[] basicRiskHdIds)
    {
        return toAjax(prjBasicRiskHdService.deletePrjBasicRiskHdByBasicRiskHdIds(basicRiskHdIds));
    }
}
